<?php if (!defined('THINK_PATH')) exit();?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="__ACSS__/css1.css" rel="stylesheet" type="text/css">
<script language='javascript' src='__AJS__/public.js'></script>
<script src="__PUBLIC__/ckeditor/ckeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/Public/Admin/Js/jquery.js"></script>
<script>
	
	$().ready(function(){
		//在线编辑器
	var ue = UE.getEditor('editor');
		//验证货号
		checksn();
		//验证名称
		check_gname();
		
		//提交时验证所有的信息	
		btnOk();
	});
	
	function checksn(){
		
		$('#sn').bind('blur',function(){
			var sn=$('#sn').val();
		var reg = eval('/^[0-9a-zA-Z]*$/gi');
		
		//判断字符串中是否有指定模式匹配的字符或字符串  返回Boolbean
		 flg=reg.test(sn);
		 
		$('#sn_cuo').css('color','red');
		 if (!flg) {
		 	
		 	$('#sn_cuo').html('货号不允许是中文!');
		
		 }
		
		 
		});
		$('#sn').bind('focus',function(){
			$('#sn_cuo').html('');
		});
		
		}
		
		function check_gname(){
			$('#g_name').bind('blur',function(){
			var g_name=$('#g_name').val();
		
		var reg = eval('/^[^%{};$!！￥@#*()><?+~&]{1,}$/gi');
		var reg1 = eval('/^.{4,15}$/gi');
		//判断字符串中是否有指定模式匹配的字符或字符串  返回Boolbean
		 flg=reg.test(g_name);
		flg1=reg1.test(g_name);

		$('#name').css('color','red');
		if(!flg1){
			$('#name').html('商品名称长度范围为4至15个!');
		}
		 if (!flg) {
		 	
		 	$('#name').html('商品名称不允许包含%、$、!、@、#等特殊字符!');
		
		 }
		 if(g_name==''){
		 	$('#name').html('商品名称不可以为空!');
		 }
		 
		});
		$('#g_name').bind('focus',function(){
			$('#name').html('');
		});
		}
		
		function btnOk(){
			$(':submit').bind('mouseover',function(){
			
				if ($('#name').html() != '') {
				
						alert('不正确的信息为：'+$('#name').html());	
				}
				if($('#sn_cuo').html() != ''){
					alert('不正确的信息为：'+$('#sn_cuo').html());	
				}
		});	
		}
		</script>
</head>

<SCRIPT language=javascript>

</SCRIPT>
<h1>
<span class="action-span1"><a href="">SHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 修改商品信息 </span>
<div style="clear:both"></div>
</h1>

<body>
<form method="POST" action="__GROUP__/Goods/update" enctype="multipart/form-data">
	<input type='hidden' name='g_id' value='<?php echo ($row["g_id"]); ?>' />
<table class="table" cellspacing="1" cellpadding="2" width="99%" align="center" 
border="0">
  <tbody>
    <tr>
      <th class="bg_tr" align="left" colspan="2" height="25">
    <!-- tab bar -->
	<div class="tab-div">
    <div id="tabbar-div">
      <p>
      <span class="tab-front" id="general-tab" onclick="changeTab('general')">修改商品信息</span>
      </p>
    </div>	
	</div>
      </th>
    </tr>
     <tr>
      <td class="td_bg" width="25%" height="23" align="right">所属分类：</td>
      <td width="83%" class="td_bg">
      <select name='c_parent_id' id='createCate'>
      	<option value='0'><?php echo ($row["c_name"]); ?></option>
		<?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($row['c_name'] != $vo['c_name']): ?><option value='<?php echo ($vo["c_id"]); ?>'><?php echo ($vo["c_name"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
		</select>
	 	<input type='hidden' name='g_id' value='<?php echo ($row["g_id"]); ?>' />
      </td>
    </tr>
	 <tr>
      <td class="td_bg" width="25%" height="23" align="right">所属品牌：</td>
      <td width="83%" class="td_bg">
      <select name='b_id' id='b_id'>
      	<option value='<?php echo ($row["b_id"]); ?>'><?php echo ($row["b_name"]); ?></option>
		<?php if(is_array($data1)): foreach($data1 as $key=>$vo): if($row['b_name'] != $vo['b_name']): ?><option value='<?php echo ($vo["b_id"]); ?>'><?php echo ($vo["b_name"]); ?></option><?php endif; endforeach; endif; ?>
      </select>
      </td>
    </tr>
    <tr>
      <td class="td_bg" width="25%" height="23" align="right">商品名称：</td>
      <td width="83%" class="td_bg">
      	<input type="text" name="g_name" id='g_name' value="<?php echo ($row["g_name"]); ?>" /><span class="require-field">*</span>&nbsp;&nbsp;<span id="name"></span>
      </td>
    </tr>
    <tr>
      <td class="td_bg" width="25%" height="23" align="right">商品货号：</td>
        <td width="83%" class="td_bg">
       <input type="text" name="g_sn"  id="sn" size="20" value="<?php echo ($row["g_sn"]); ?>" /><span class="require-field">*</span>&nbsp;&nbsp;<span id="sn_cuo"></span>        
        </td>
    </tr>
	</tr>
	<tr>
      <td class="td_bg" width="20%" height="10" align="right"></td>
        <td width="83%" class="td_bg">
      <span class="require-tishi">货号如不填系统自动生成(格式:GOODSxxxxx)</span> 
	       
        </td>
    </tr>
	  <tr>
            <td class="td_bg" width="25%" height="23" align="right">售价：</td>
            <td width="83%" class="td_bg"><input type="text" name="g_price" value="<?php echo ($row["g_price"]); ?>" size="20" onblur="priceSetted()"/><span class="require-field">*</span>
            </td>
     </tr>
	  <tr>
            <td class="td_bg" width="25%" height="23" align="right">库存数量：</td>
            <td  width="83%" class="td_bg"><input type="text" name="g_inv" value="<?php echo ($row["g_inv"]); ?>" size="20" /><span class="require-field">*</span><br />
            </td>
          </tr>
		  <tr>
            <td class="td_bg" width="25%" height="23" align="right">加入推荐：</td>
            <td  width="83%" class="td_bg">
                <?php if($row['g_is_new'] == 1): ?><input type="checkbox" name="g_is_new" value="1" checked="checked"/>新品
				<?php else: ?>
				<input type="checkbox" name="g_is_new" value="1"/>新品<?php endif; ?>
                <?php if($row['g_is_hot'] == 1): ?><input type="checkbox" name="g_is_hot" value="1" checked="checked" />热销
				<?php else: ?>
				<input type="checkbox" name="g_is_hot" value="1"/>新品<?php endif; ?>
            </td>
          </tr>
		    <tr>
            <td class="td_bg" width="25%" height="23" align="right">上架：</td>
            <td width="83%" class="td_bg"><input type="checkbox" name="g_is_sale" value="1" checked="checked" /> 打勾表示允许销售，否则不允许销售。</td>
          </tr>
    <tr>
      <td class="td_bg" width="25%" height="23" align="right">商品描述：</td>
      <td width="83%" class="td_bg">
      	<textarea name='g_desc' id='editor' rows='4' cols='80'><?php echo ($row["g_desc"]); ?></textarea>
      </td>
    </tr>
	<tr>
      <td class="td_bg" width="25%" height="23" align="right">排序：</td>
      <td width="23%" class="td_bg">
      	<input type="text" name="g_sort" id='name' value="<?php echo ($row["g_sort"]); ?>"/>
      </td>
    </tr>
	  <tr>
            <td class="td_bg" width="25%" height="23" align="right">上传商品图片：</td>
            <td width="23%" class="td_bg">
              <input type="file" name="g_img" size="35" /><span>当前的图片路径为:<font color="#ff0000">__HUP__<?php echo ($row["g_img"]); ?></font></span>
            </td>
          </tr>
    <tr>
      <td class="td_bg" width="25%" height="23"></td>
      <td class="td_bg" width="83%">
      	<input type="submit" name="submit" value="修改" />
      </td>
    </tr>
  </tbody>
</table>
</form>
</body>
</html>